﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;

namespace 水费管理系统
{
    public partial class 统计分析 : Form
    {
        public 统计分析()
        {
            InitializeComponent();
        }

        private void LocalReport_SubreportProcessing(object sender, Microsoft.Reporting.WinForms.SubreportProcessingEventArgs e)
        {

            //e.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource(reportName, ds1.Tables[0]));

        }
        private void 统计分析_Load(object sender, EventArgs e)
        {
            // TODO: 这行代码将数据加载到表“dataSet1.抄表”中。您可以根据需要移动或移除它。
            this.抄表TableAdapter.Fill(this.dataSet1.抄表);
            // TODO: 这行代码将数据加载到表“dataSet1.收费”中。您可以根据需要移动或移除它。
            this.收费TableAdapter.Fill(this.dataSet1.收费);
            // TODO: 这行代码将数据加载到表“DataSet1.抄表”中。您可以根据需要移动或移除它。

            this.reportViewer1.RefreshReport();
            this.reportViewer1.LocalReport.SubreportProcessing+=new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
            //reportManager.Viewer.LocalReport.SubreportProcessing += new Microsoft.Reporting.WinForms.SubreportProcessingEventHandler(LocalReport_SubreportProcessing);

        }

        private void treeView1_MouseClick(object sender, MouseEventArgs e)
        {
            
        }

        private void 单位抄表记录ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            单位抄表记录 dwcbjl = new 单位抄表记录();
            if (dwcbjl.ShowDialog() == DialogResult.OK)
            {
                this.reportViewer1.LocalReport.ReportEmbeddedResource = "水费管理系统.报表.单位抄表记录.rdlc";
                this.reportViewer1.LocalReport.DataSources.Clear();
                
                this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_抄表",this.抄表TableAdapter.Get单位记录(dwcbjl.用户单位,dwcbjl.年度,dwcbjl.月份)));
                this.reportViewer1.RefreshReport();
                //this.reportViewer1.PrintDialog();
            }
            dwcbjl.Dispose();
        }

        private void 收据查询ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.reportViewer1.LocalReport.ReportEmbeddedResource = "水费管理系统.报表.收据.rdlc";
            this.reportViewer1.LocalReport.DataSources.Clear();

            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_收费",this.收费TableAdapter.GetData()));
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_抄表", this.抄表TableAdapter.GetData()));
            this.reportViewer1.RefreshReport();
            //this.reportViewer1.PrintDialog();
        }
    }
}